"""
约瑟夫环跳海问题
"""

def jump():
   pass


def sort1():
    """冒泡排序"""

    num = 1
    list1 = [22, 45, 67, 12, 88, 42, 93, 27]
    while num < len(list1):
        swap = False
        for x in range(len(list1)-num):
            if list1[x]>list1[x+1]:
                list1[x],list1[x+1] = list1[x+1],list1[x]
                swap = True

        num += 1
        if not swap:
            break
        

def max_num(m,n):
    r = m%n
    m,n = n,r
    if r == 0:
        return m
    else:
        return max_num(m,n)
    

def main():
    persons = [True]*30
    index, num, counter = 0, 0, 0
    while counter < 15:
        if persons[index]:
            num+=1
            if num == 9:
                persons[index] = False
                counter += 1
                num = 0
        index += 1
        if index == 30
            index = 0
       # index %= len(persons)
    for pos ,person in enumerate(persons):
        print(pos,'基' if person else '非')
    print(sort1())
    print(max_num(27,15))

if __name__== '__main__': 
    main()
